package com.dz.mapper;

import com.dz.entity.AddressBook;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 鄧浩奇
 * @classname AddressMapper
 * @description
 * @since 2024/4/4 17:35
 **/

@Mapper
public interface AddressMapper {


    /*
    * 新增地址
    * */
    Integer insertAddress(AddressBook addressBook);

    /*
    * 查询地址
    * */
    List<AddressBook> selectAddressesByUserID(Long userID);

    /*
    * 设置默认地址
    * */
    Integer updateDefaultByAddressId(@Param("userId") Long userId, @Param("addressID") Integer addressID);

    /*
    * 查询默认地址
    * */
    AddressBook selectDefaultByUserId(Long userID);

    /*
    * 根据id查询地址
    * */
    AddressBook selectAddressById(Long id);

    /*
    * 根据id修改地址
    * */
    Integer updateAddressById(AddressBook addressBook);

    /*
    * 根据id删除地址
    * */
    Integer deleteById(Long id);
}
